/* 
 * File:   Exceptions.h
 * Author: Elevator
 *
 * Created on July 29, 2013, 9:29 PM
 */

#ifndef DATA_EXCEPTIONS_H
#define DATA_EXCEPTIONS_H

#include <string>
#include "Common/Common.h"

namespace data {

	class ResourceOpenException : public Exception {
	public:

		ResourceOpenException( std::string filename ) throw ( ) :
		Exception( "Unable to open resource file " + filename ),
		_filename( filename ) {
		}

		ResourceOpenException( const ResourceOpenException& orig ) throw ( ) :
		Exception( "Unable to open resource file " + orig._filename ),
		_filename( orig._filename ) {
		}

		~ResourceOpenException( ) throw ( ) {
		}
	private:
		std::string _filename;
	};

	class ParserException : public Exception {
	public:

		ParserException( std::string filename, std::string parserMessage ) throw ( ) :
		Exception( "Error while reading resource " + filename + ": " + parserMessage ),
		_filename( filename ),
		_parserMessage( parserMessage ) {
			std::cout << "Error while reading resource " << filename << ": " << parserMessage;
		}

		ParserException( const ParserException& orig ) throw ( ) :
		Exception( "Error while reading resource " + orig._filename + ": " + orig._parserMessage ),
		_filename( orig._filename ),
		_parserMessage( orig._parserMessage ) {
		}

		~ParserException( ) throw ( ) {
		}

	private:
		std::string _filename;
		std::string _parserMessage;
	};
}
#endif	/* DATA_EXCEPTIONS_H */

